﻿using System.Data;
using System.Runtime.Serialization;
using System.ServiceModel;

namespace HRMService
{

    [ServiceContract(Namespace = "http://HRMService")]
    public interface IUser
    {
        [OperationContract]
        bool User_Exist(string _username);
        [OperationContract]
        DataSet User_GetAllUsersByBranch(int _branchID, int pageIndex, int pageSize, out int totalRecord);

        [OperationContract]
        bool User_Delete(string UserName);

        [OperationContract]
        string[] User_GetAllRoles();

        [OperationContract]
        string[] User_GetUserRoles(string UserName);

        [OperationContract]
        string User_CreateRole(string roleName);

        [OperationContract]
        string User_DeleteRole(string roleName);

        [OperationContract]
        string User_AddUserToRole(string userName, string roleName);

        [OperationContract]
        string User_RemoveUserFromRole(string userName, string roleName);

        [OperationContract]
        bool User_IsUserInRole(string userName, string roleName);

        [OperationContract]
        string User_Update(string userName, string passWord, string eMail, string fullName, string Address, string Phone, string BranchID, string DepartmentID, string position, string RegionCode);
        [OperationContract]
        string User_Create(string userName, string passWord, string eMail, string fullName, string Address, string Phone, string BranchID, string DepartmentID, string position, string RegionCode);

        [OperationContract]
        DataSet User_GetInfo(string userName);

        [OperationContract]
        bool User_ChangePassword(string userName, string oldPass, string passWord);
        [OperationContract]
        UserInfo User_GetUserInfo(string userName);
        [OperationContract]
        DataSet User_GetList(out int ItemCount, int currentPage, int pageSize,string RegionCode, int BranchID);

        //Service cho phần phân quyền user quản lý chi nhánh
        [OperationContract]
        int UserBranch_Create(string username, string branch_code);

        [OperationContract]
        int UserBranch_Delete(string username,string branch_code);
        
        [OperationContract]
        DataSet UserBranch_GetListManage(string regioncode,string branchname, string username, int type);

        [OperationContract]
        DataSet UserBranch_GetListChuyenQuan(int type, string username);
        
    }

    [DataContract(Namespace = "http://HRMService")]
    public class UserInfo
    {
        string _userName;
        [DataMember]
        public string UserName
        {
            get { return _userName; }
            set { _userName = value; }
        }
        string _passWord;
        [DataMember]
        public string PassWord
        {
            get { return _passWord; }
            set { _passWord = value; }
        }
        string _email;
        [DataMember]
        public string Email
        {
            get { return _email; }
            set { _email = value; }
        }
        string _address;
        [DataMember]
        public string Address
        {
            get { return _address; }
            set { _address = value; }
        }
        string _fullName;
        [DataMember]
        public string FullName
        {
            get { return _fullName; }
            set { _fullName = value; }
        }
        string _phone;
        [DataMember]
        public string Phone
        {
            get { return _phone; }
            set { _phone = value; }
        }
        string _branchID;
        [DataMember]
        public string BranchID
        {
            get { return _branchID; }
            set { _branchID = value; }
        }

        string _position;
        [DataMember]
        public string Position
        {
            get { return _position; }
            set { _position = value; }
        }
        string _departmentID;
        [DataMember]
        public string DepartmentID
        {
            get { return _departmentID; }
            set { _departmentID = value; }
        }
        string _RegionCode;
        [DataMember]
        public string RegionCode
        {
            get { return _RegionCode; }
            set { _RegionCode = value; }
        }
    }

    //[DataContract(Namespace = "http://HRMService")]
    //public class UserBranchInfo
    //{
    //    string _Username;
    //    [DataMember]
    //    public string Username
    //    {
    //        get { return _Username; }
    //        set { _Username = value; }
    //    }

    //    string _BranchCode;
    //    [DataMember]
    //    public string BranchCode
    //    {
    //        get { return _BranchCode; }
    //        set { _BranchCode = value; }
    //    }

    //    string _BranchName;
    //    [DataMember]
    //    public string BranchName
    //    {
    //        get { return _BranchName; }
    //        set { _BranchName = value; }
    //    }
    //}
}
